<template>
  <div>
    <div 
    class="title" 
    v-for="(item, index) of list" 
    :key="index"
    >
      <div class="title-wrapper border-bottom">
        <span class="title-icon"></span>
        {{item.title}}
      </div>
      <!-- 递归组件, 有了name属性就可以在组件自身上调用自己 -->
      <div v-if="item.children" class="children">
        <detail-list :list="item.children"></detail-list>
      </div>
    </div>
    
  </div>
</template>
<script>
export default {
  name: "DetailList",
  props: {
    list: Array
  }
};
</script>
<style lang="stylus" scoped>
.title{
  .children {
    padding-left 0.2rem
  }
  .title-wrapper {
    height: 0.6rem;
    line-height: 0.6rem;
    font-size: 0.32rem;
    
    .title-icon {
      display: inline-block;
      position: relative;
      left: 0.2rem;
      top: 0.1rem;
      width: 0.4rem;
      height: 0.4rem;
      background: url('//s.qunarzz.com/piao/image/touch/sight/detail.png') 0 -0.45rem no-repeat;
      margin-right: 0.1rem;
      background-size: cover;
    }
  }
}
</style>
